import { useUserStore } from "@/store/module/user";
import { App } from "vue";

export const regPermission = (app: App<Element>) => {
    app.directive('permission', {
        mounted(el, binding) {
            const userStore = useUserStore();
            // 从仓库数据中判断是否存在 binding.value, 如果不存在，没有权限，删除dom元素
            if(!userStore.getPremission.includes(binding.value)){
                el.remove();
            }
        }
    })
}